/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 *
 * @author Andres
 */
@Entity
@Table(name = "TRANSPORTEAEREO", catalog = "", schema = "PROYECTO", uniqueConstraints = {
    @UniqueConstraint(columnNames = {"CONVENIOS_CODIGOCONVENIO"}),
    @UniqueConstraint(columnNames = {"DIRECCION_CODIGO"})})
@NamedQueries({
    @NamedQuery(name = "Transporteaereo.findAll", query = "SELECT t FROM Transporteaereo t"),
    @NamedQuery(name = "Transporteaereo.findByIdTransporte", query = "SELECT t FROM Transporteaereo t WHERE t.idTransporte = :idTransporte")})
public class Transporteaereo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_TRANSPORTE", nullable = false)
    private Integer idTransporte;
    @JoinColumn(name = "ID_TRANSPORTE", referencedColumnName = "CODIGO_EMPRESA", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.EAGER)
    private Transporte transporte;
    @JoinColumn(name = "DIRECCION_CODIGO", referencedColumnName = "CODIGO", nullable = false)
    @OneToOne(optional = false, fetch = FetchType.EAGER)
    private Direccion direccion;
    @JoinColumn(name = "CONVENIOS_CODIGOCONVENIO", referencedColumnName = "CODIGOCONVENIO")
    @OneToOne(fetch = FetchType.EAGER)
    private Convenios convenios;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "transporteaereo", fetch = FetchType.EAGER)
    private List<Vuelo> vueloList;

    public Transporteaereo() {
    }

    public Transporteaereo(Integer idTransporte) {
        this.idTransporte = idTransporte;
    }

    public Integer getIdTransporte() {
        return idTransporte;
    }

    public void setIdTransporte(Integer idTransporte) {
        this.idTransporte = idTransporte;
    }

    public Transporte getTransporte() {
        return transporte;
    }

    public void setTransporte(Transporte transporte) {
        this.transporte = transporte;
    }

    public Direccion getDireccion() {
        return direccion;
    }

    public void setDireccion(Direccion direccion) {
        this.direccion = direccion;
    }

    public Convenios getConvenios() {
        return convenios;
    }

    public void setConvenios(Convenios convenios) {
        this.convenios = convenios;
    }

    public List<Vuelo> getVueloList() {
        return vueloList;
    }

    public void setVueloList(List<Vuelo> vueloList) {
        this.vueloList = vueloList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTransporte != null ? idTransporte.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Transporteaereo)) {
            return false;
        }
        Transporteaereo other = (Transporteaereo) object;
        if ((this.idTransporte == null && other.idTransporte != null) || (this.idTransporte != null && !this.idTransporte.equals(other.idTransporte))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Transporteaereo[idTransporte=" + idTransporte + "]";
    }

}
